<template>
  <ul class="catagtory">
    <li :class="{'select': item.id === currentCatagtory}"
      @click="$store.commit('catagtory/updateCurrentCatagtory', item.id)"
      v-for="item in catagtory"
      :key="item.id">
      {{ item.name }}
    </li>
  </ul>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'catagtory-head',
  computed: {
    ...mapGetters(['catagtory', 'currentCatagtory'])
  },
  created () {
    this.$store.dispatch('catagtory/getCatagtory')
  }
}
</script>

<style>

</style>
